import java.util.Scanner;

public class Testclass1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Class1 a = new Class1();
        a.name = "java78";
        a.dirTeacher = "刘老师";
        a.startDate = "2022年3月1日";
        while (true) {
            System.out.println("1.查看班级信息");
            System.out.println("2.添加学生");
            System.out.println("3.查询学生");
            System.out.println("学生改名");
            System.out.println("查询学生数量");
            int chioce = input.nextInt();
            switch (chioce) {
                case 1:
                    a.showInformation();
                    break;
                case 2:
                    System.out.println("请输入学生的姓名");
                    String names = input.next();
                    a.add(names);
                    break;
                case 3:
                    System.out.println("请输入编号");
                    int number = input.nextInt();
                    System.out.println(a.show(number));
                    break;
                case 4:
                    System.out.println("请输入要修改的学生姓名");
                    String oldName = input.next();
                    System.out.println("请输入修改后的学生姓名");
                    String newName = input.next();
                    boolean flag = a.update(oldName, newName);
                    if (!flag){
                        System.out.println("无此姓名");
                        continue;
                    }
                    System.out.println("姓名修改成功");
                    break;
                case 5:
                    System.out.println(a.count);
                    break;
                default:
                    break;

            }
            if (chioce==0){
                System.out.println("退出");
                break;

            }

        }

    }
}
